﻿using EYangFramework.Common.Ninject;
using EYangFramework.Domain.Entitys.Entrys;
using EYangFramework.Domain.Entitys.ValueObjects;
using System;
using System.Collections.Generic;
using System.Data.Entity;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace EYangFrame.DataAccess
{
    [AutoBind(ServiceType = typeof(DbContext), ImpleType = typeof(EYangDbContext))]
    public class EYangDbContext : DbContext
    {
        public EYangDbContext() :
            base("Oracle")
        {
            this.Configuration.AutoDetectChangesEnabled = true;//对多对多，一对多进行curd操作时需要为true
        }
        protected override void OnModelCreating(DbModelBuilder modelBuilder)
        {
            base.OnModelCreating(modelBuilder);
            modelBuilder.HasDefaultSchema("SCOTT");
        }
        public DbSet<User> User { get; set; }
        public DbSet<Role> Role { get; set; }
        public DbSet<Navigation> Navigation { get; set; }
        public DbSet<Menu> Menu { get; set; }
        public DbSet<Message> Message { get; set; }
        public DbSet<LinkUser> LinkUser { get; set; }
        public DbSet<MessageModel> MessageModel { get; set; }
    }
}
